package com.wenwo.logging.service.impl;

import com.alibaba.fastjson.JSON;
import com.wenwo.logging.dto.MethodInvokeInfoDTO;
import com.wenwo.logging.properties.LogCollectUrlProperties;
import com.wenwo.logging.service.LogService;
import com.wenwo.logging.util.HttpRequestUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * @program: logging
 * @className: LogServiceImpl.java
 * @description:
 * @author: ZY
 * @create: 2020年08月02日 18:45
 **/
@Slf4j
@Service
public class LogServiceImpl implements LogService {

    /**
     * 异步上报@Log注解的方法调用信息给相关系统
     *
     * @param dto 参数
     */
    @Async
    @Override
    public void logMethodInvokeInfo(MethodInvokeInfoDTO dto) {
        HttpRequestUtil.sendPost(LogCollectUrlProperties.methodInvokeUrl, JSON.toJSONString(dto), null);
    }
}
